Skip to content

feat(voice): add mobile linking and cancellation - #3361

Draft
johnmatthewtennant wants to merge 1 commit into
jt/buzz-voice-refactorfrom
jtennant/buzz-voice-mobile-linking-april
Draft

feat(voice): add mobile linking and cancellation#3361
johnmatthewtennant wants to merge 1 commit into
jt/buzz-voice-refactorfrom
jtennant/buzz-voice-mobile-linking-april

Conversation

@johnmatthewtennant

Copy link
Copy Markdown
Contributor

Context

buzz-voice is reusable Rust code, but the published sherpa-onnx-sys build rejects iOS and Android targets before a client can supply the official native libraries. Mobile clients also need an interruptible synthesis contract so session cancellation does not wait for a full utterance.

Summary

This PR adds explicit static and shared link modes, a backwards-compatible cancellation callback for the April Pocket engine, and a provenance-preserving sherpa-onnx-sys patch that links caller-supplied official mobile libraries through SHERPA_ONNX_LIB_DIR.

No model or native binary is bundled.

Changes

  • Keeps static as the default buzz-voice link mode and adds an explicit shared mode.
  • Preserves synth_chunk and adds synth_chunk_with_callback(text, lang, style, steps, Option<F>).
  • Polls cancellation during April latent generation, reports monotonic progress across split text chunks, rejects same-engine callback re-entry, and converts callback panics into errors without poisoning the engine mutex.
  • Carries the upstream sherpa-onnx-sys 1.13.4 metadata, bindings, license, and Cargo.toml.orig unchanged.
  • Adds fail-closed iOS static and Android shared linking for caller-supplied official libraries.
  • Keeps the patched sys package outside cargo-chef's version-masked workspace recipe and copies its real source into both Docker dependency builders.

Related issue

None found.

Testing

  • cargo fmt --all -- --check: passed.
  • cargo test --locked -p buzz-voice --lib: 8 passed, 4 model-dependent tests ignored.
  • Static and shared host checks: passed.
  • Static and shared clippy with -D warnings: passed.
  • cargo package --locked --offline --allow-dirty -p buzz-voice: passed.
  • Root and Desktop locked metadata: passed.
  • Rust target checks passed for aarch64-apple-ios, aarch64-apple-ios-sim, aarch64-linux-android, and x86_64-linux-android through the fail-closed caller-library interface.
  • The prior package implementation produced real non-silent 24 kHz PCM on both iOS and Android in Berd Mobile draft PR Add desktop Home feed #12. Fresh official-library linking and PCM against the April engine remain required when downstream consumers repin to this head.
  • Focused NCMB, Stacksmith, Kalvin, minimize-diff, timeless-comment, and dead-code reviews are clean after fixing callback progress, re-entry, and panic handling.
  • DCO trailers are present on both commits.

Screenshots

N/A. This is a Rust API and native-link packaging change with no UI.

Reviewer-reproducible examples

Run the callback and April engine tests:

cargo test --locked -p buzz-voice --lib

Exercise both host link modes:

SHERPA_ONNX_ARCHIVE_DIR=/absolute/path/to/official/archives \
  cargo check --locked -p buzz-voice --all-targets

SHERPA_ONNX_ARCHIVE_DIR=/absolute/path/to/official/archives \
  cargo check --locked -p buzz-voice --all-targets \
  --no-default-features --features shared

With official sherpa-onnx 1.13.4 libraries prepared by the caller:

SHERPA_ONNX_LIB_DIR=/absolute/path/to/iphoneos-arm64 \
  cargo check --locked -p buzz-voice --target aarch64-apple-ios \
  --no-default-features --features static

SHERPA_ONNX_LIB_DIR=/absolute/path/to/arm64-v8a \
  cargo check --locked -p buzz-voice --target aarch64-linux-android \
  --no-default-features --features shared

@johnmatthewtennant
johnmatthewtennant changed the base branch from jtennant/buzz-voice-extraction-april to jt/buzz-voice-refactor July 28, 2026 19:19

johnmatthewtennant commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Terminal CI bookkeeping for exact mobile-linking head 19ea0adc6eaefbf4842b88ce8fd7c1b5691bddc0 on slim base 617e0d27a7574a993cbe00a30959e75641c95880:

  • DCO, Semgrep OSS, and zizmor passed.
  • CI workflow: SUCCESS. Rust lint, unit tests, Desktop core/build/smoke/E2E, security, Windows Rust, both Linux cross-compiles, backend integration, and relay E2E passed. Web and Mobile were path-skipped as expected.
  • Docker workflow: all four PR image builds passed; manifest publication jobs were skipped as expected for a pull request.
  • Final total: 28 passed, 4 intentionally skipped, 0 pending, 0 failed.
  • The same-repo head branch resolves exactly to this SHA; no model or native binary is bundled.

No readiness or merge action was taken; the PR remains OPEN+DRAFT.

@johnmatthewtennant
johnmatthewtennant force-pushed the jtennant/buzz-voice-mobile-linking-april branch from df2b7d9 to 5514cb2 Compare July 28, 2026 21:00
@johnmatthewtennant
johnmatthewtennant force-pushed the jtennant/buzz-voice-mobile-linking-april branch from 5514cb2 to 19ea0ad Compare July 28, 2026 21:43
@johnmatthewtennant
johnmatthewtennant force-pushed the jtennant/buzz-voice-mobile-linking-april branch from 19ea0ad to b1c899f Compare July 29, 2026 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant